class LevelGameDataParse {

    public static parseLevelGameData(level: any) {
        GameData.stepNum = level.step;
        GameData.levelStepNum = level.step;
        GameData.elementTypes = level.element;
        GameData.levelBackgroungImageName = level.levelbgimg;

        LevelGameDataParse.parseLevelReq(level.levelreq);
    }

    private static parseLevelReq(levelreq: any) {
        GameData.levelreq.openChange();
        let len: number = levelreq.length;
        for (let i = 0; i < len; i++) {
            GameData.levelreq.addElement(levelreq[i].type, levelreq[i].num);
        }
    }
}